<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="../common/tag.jsp" %>
<c:set var="_underAppUpload" value="active" scope="request"/>
<c:set var="_pageTitle" value="新版本信息提交" scope="request"/>
<!DOCTYPE html>
<html>
<head>
    <title>${_pageTitle}</title>
    <%@include file="../common/head.jsp" %>
</head>
<body>
<%@include file="../common/topbar.jsp" %>
<div class="ch-container">
    <div class="row">
        <%@include file="../common/left.jsp" %>
        <!-- main content -->
        <div class="page-header"><h3>${_pageTitle}</h3></div>
        <form id="search_form" action="${basePath}/AppVersion/AppUpdateInfoUpload" enctype="multipart/form-data"
              method="post" class="form-inline">
            <table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                <tr>
                    <th style="padding: 10px">版本号：</th>
                    <td><input type="text" name="version" class="form-control"></td>
                </tr>
                <tr>
                    <th style="padding: 10px">Build编号</th>
                    <td><input type="text" name="build" class="form-control"></td>
                </tr>
                <tr>
                    <th style="vertical-align: top; padding-right: 10px;">更新日志</th>
                    <td>
                        <div style="margin-bottom: 10px">
                            <input id="add" type="button" class="btn btn-default" value="添加"/>
                        </div>
                        <div id="logList">
                            <div style="float: left; margin-right: 20px; margin-bottom: 10px" class="log-item">
                                <textarea style="width: 200px; height: 100px; margin-bottom: 10px" name="updataLog"
                                          class="form-control"></textarea>
                                <div>
								<span style="float: left"> 语言：<select name="languageId"
                                                                      class="form-control selectWidth">
										<option value="1">中文</option>
										<option value="2">英文</option>
								</select>
								</span> <span style="float: right">
									<button type="button" class="delete-log btn btn-danger">删除</button>
								</span>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <th style="padding: 10px">终端类型：</th>
                    <td><select name="type" class="form-control selectWidth">
                        <option value="1">IOS</option>
                        <option value="2">Android</option>
                    </select></td>
                </tr>
                <tr>
                    <th style="padding: 10px">发布类型：</th>
                    <td><select name="status" class="form-control selectWidth">
                        <option value="1">测试环境</option>
                        <option value="2">生产环境</option>
                    </select></td>
                </tr>
                <tr>
                    <th style="padding: 10px">版本日期：</th>
                    <td><input type="text" class="form-control form_date" id="editionTime" value=""
                               data-date-format="yyyy-mm-dd" name="startTime"
                               placeholder="Date Start"></td>
                </tr>
                <tr>
                    <th style="padding: 10px">强制更新：</th>
                    <td><select name="forcibility" class="form-control selectWidth">
                        <option value="1">是</option>
                        <option value="0">否</option>
                    </select></td>
                </tr>
                <tr>
                    <th style="padding: 10px">文件大小：</th>
                    <td><input type="text" name="contentLength" class="form-control"/></td>
                </tr>
                <tr>
                    <th style="padding: 10px">文件：</th>
                    <td><input type="file" name="multipartFile" class="form-control"/></td>
                </tr>
                <tr style="border-top: 1px solid #ccc;">
                    <td></td>
                    <td><input id="upload" type="button" value="上传" class="btn btn-primary"/></td>
                </tr>
            </table>
        </form>
        <!-- end main content -->
        <!-- content ends -->

        <c:import url="../common/footer.jsp"/>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#upload").click(function () {
                    $(this).attr("disabled", "true");
                    $("#form").submit();
                });
                $("#add").click(function () {
                    var divdom = '<div  style="float: left;margin-right: 20px;margin-bottom: 10px" class="log-item">' +
                        '        <textarea style="width: 200px; height: 100px;margin-bottom: 10px"' +
                        '                  name="updataLog"></textarea>' +
                        '                        <div>' +
                        '                           <span style="float: left">' +
                        '                                语言：<select' +
                        '                                   name="languageId" class="form-control selectWidth">' +
                        '                            <option value="1">中文</option>' +
                        '                            <option value="2">英文</option>' +
                        '                        </select>' +
                        '                           </span>' +
                        '                            <span style="float: right">' +
                        '                                 <button type="button" class="delete-log btn btn-default">删除</button>' +
                        '                            </span>' +
                        '                        </div>' +
                        '                    </div>';
                    $("#logList").append(divdom);
                });
                $("#logList").on('click', '.delete-log', function () {
                    $(this).parent().parent().parent('div.log-item').remove();
                });
            });
        </script>